﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using FreeGoo.GameEngine;
using FreeGoo.GameEngine.Renderables.BodyHookOwners;
using FreeGoo.GameEngine.Renderables.Particles;
using FreeGoo.GameEngine.Renderables.Particles.Keys;

namespace FreeGoo.LevelClasses.LevelParts.Particles.Keys
{
    public class KeyedMotorKeyLevelPart : LevelPartParticle
    {
        public override string Name { get { return "KeyedMotorKeyParticle"; } }

        public override Particle BuildParticle(Level level, XElement element)
        {
            KeyedMotorKey keyedMotorKey = ParticleFactory.CreateKeyedMotorKey(
                level.Engine,
                GetOffsetPosition(level, element),
                ParticleFactory.DefaultKeyParticleRadius);

            if (element.Attribute("Direction").ToString2("Forward").Equals("Forward"))
            {
                keyedMotorKey.Direction = KeyedMotor.Direction.Forward;
            }
            else
            {
                keyedMotorKey.Direction = KeyedMotor.Direction.Backward;
            }

            return keyedMotorKey;
        }
    }
}
